home *** CD-ROM | disk | FTP | other *** search
- Path: nntp.uib.no!usenet
- From: ketil@ii.uib.no (Ketil Z Malde)
- Newsgroups: comp.lang.c++
- Subject: Re: Overloading operator [][] as in A[][]: possible?!
- Date: 14 Feb 1996 16:35:00 +0100
- Organization: II, UiB
- Sender: ketil@haukugle.ii.uib.no
- Message-ID: <eg68d9apjv.fsf@haukugle.ii.uib.no>
- References: <311F6E92.794BDF32@cenparmi.concordia.ca>
- Reply-To: ketil@ii.uib.no
- NNTP-Posting-Host: haukugle.ii.uib.no
- X-Newsreader: September Gnus v0.38/XEmacs 19.13
-
- >>>>> "D" == Didier Guillevic <didier@cenparmi.concordia.ca> writes:
-
- D> Learning C++ at the moment....
-
- Me too
-
- D> Any way to overload
- D> the indexing of a 2 dimensional array, as in
-
- D> A[i][j]
-
- This means an array of j pointers to i As, remember? I guess you
- *could* overload the [] operator for A, and then again for A*, but I
- haven't seen it done.
-
- Using the double-[] semantics for two-dim arrays is a mess (IMHO).
-
- D> If possible, I would prefer to avoid using a notation such as:
-
- D> A(i,j)
-
- Me too
-
- I don't like that either, but it seems to be the de facto standard way
- of doing things. I'd really like to be able to oveload [] to take
- more than one argument, but apparently I can't -- at least not
- without overloading the , operator as well. I guess we're stuck with
- what looks like a constructor.
-
- I'm sure this has come up in the discussion about changes to C++, if
- somebody can enlighten me why the multi-argument [] was turned down,
- I'd be grateful.
-
- -kzm
-
-
-